package com.cake.liulanxiangzhu.web;

public enum CakeStateCode {

    UNPAY(1, "待付款"),
    PAY(2, "待发货"),
    DELIVE(3, "待收货"),
    RECEIVED(4, "已签收");

    private Integer code;
    private String msg;

    CakeStateCode(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }


    public Integer getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.msg;
    }


    public boolean equals(String code) {
        if (this.code.equals(Integer.parseInt(code))) {
            return true;
        } else {
            return false;
        }
    }

    public boolean equals(Integer code) {
        if (this.code == code) {
            return true;
        } else {
            return false;
        }
    }

    public static String getDesc(Integer code) {
        CakeStateCode[] values = CakeStateCode.values();
        for (CakeStateCode value : values) {
            if (value.getCode().equals(code)) {
                return value.getMessage();
            }
        }
        return "";
    }
}
